import React, { Component } from 'react'
import {Switch,Route,BrowserRouter,Redirect} from "react-router-dom"
//登录组件
import Login from '../views/login/Login'
//dash组件
import Dash from '../views/dash/Dash'

import 'antd/dist/antd.css'
export default class Router extends Component {
    render() {
        return (
            <BrowserRouter>
            <Switch>
                <Route path='/login' component={Login}></Route>
                <Route path='/' render={()=>
                    localStorage.getItem("token")?
                    <Dash></Dash>
                    :
                    <Redirect to="/login"/>
                }/>
               
            </Switch>
            </BrowserRouter>
        )
    }
}
